package ext

import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.graphics.drawable.LayerDrawable
import android.graphics.drawable.StateListDrawable


fun stateDrawableWithColor(color1: Int, color2: Int): Drawable {
    val state = StateListDrawable()
    val colorDrawable1 = ColorDrawable(color1)
    val colorDrawable2 = ColorDrawable(color2)
    val layerDrawable = LayerDrawable(arrayOf(colorDrawable1, colorDrawable2))
    state.addState(intArrayOf(-android.R.attr.state_pressed), colorDrawable1)
    state.addState(intArrayOf(android.R.attr.state_pressed), layerDrawable)
    return state
}
